<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>父组件和子组件</title>
</head>
<body>
<div id="app">
    <h1>{{message}}</h1>
    <cpn1></cpn1>
    <!--    <cpn2></cpn2>-->
</div>
<script src="../../js/vue.js"></script>
<script>
    //2.创建第二个组件构造器
    const cpnC2 = Vue.extend({
        template: `
           <div>我是一个子级盒子</div>
        `
    });
    //1.创建第一个组件构造器
    const cpnC1 = Vue.extend({
        template: `
            <div>
                 <div>我是一个父级盒子</div>
                 <cpn2></cpn2>
            </div>
        `,
        components: {//在父级组件里面注册子级组件
            cpn2: cpnC2
        }
    });
    Vue.component("cpn1", cpnC1);
    const app = new Vue({
        el: "#app",
        data: {
            message: "你好，世界",
        },
       /* components: {
            cpn1: cpnc1
        }*/
    })
</script>
</body>
</html>